package com.yunxin.admin.system.application.assembler;

import com.yunxin.admin.system.application.command.UpdateDeptCommand;
import com.yunxin.admin.system.domain.model.dept.Dept;
import com.yunxin.admin.system.infra.persistence.entity.SysDeptDO;
import com.yunxin.admin.system.application.command.AddDeptCommand;
import com.yunxin.admin.system.application.dto.DeptDTO;
import com.yunxin.admin.system.application.dto.DeptInfoDTO;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;

/**
 * 部门对象转换器
 *
 * @author zero°
 * @since 2023-05-22
 */
@Mapper(componentModel = "spring")
public interface DeptAssembler {

    /**
     * entity 转 dto
     * @param entity entity
     * @return DeptInfoDTO
     */
    DeptInfoDTO toDeptInfoDTO(SysDeptDO entity);

    /**
     * entity 转 dto
     * @param entity entity
     * @return DeptDTO
     */
    DeptDTO toDeptDTO(SysDeptDO entity);

    /**
     * command 转 entity
     * @param command command
     * @return SysDept
     */
    Dept formAddDeptCommand(AddDeptCommand command);

    /**
     * command 转 entity
     * @param command command
     * @return SysDept
     */
    @InheritInverseConfiguration(name="toDeptInfoDTO")
    Dept formUpdateDeptCommand(UpdateDeptCommand command);



}